import store from "./index";
import {UPDATE,ADDITEM,PLUS_COUNT,REDUCE_COUNT,CKITEM,ADDCITY,SUBCART,CKSEL,CLEARPLACE} from "./constant";
// 混入
export default {
  methods:{
    plusCount(id){
      store.commit(PLUS_COUNT,id)
    },
    reduceCount(id){
      store.commit(REDUCE_COUNT,id)
    },
    minisCount(){
      store.state.count--;
    },
    changeTitle(){
      store.dispatch(UPDATE);
    },
    addCartItem(item){
      store.commit(ADDITEM,item)
    },
    ckItem(id){
      store.commit(CKITEM,id)
    },
    addCity(item){
      store.commit(ADDCITY,item)
    },
    subCarts(){
      console.log("sss")
      store.commit(SUBCART)
    },
    ckSel(item){
      store.commit(CKSEL,item)
    },
    placeClear(){
      store.commit(CLEARPLACE)
    }
  } ,
  computed:{
    count:function(){
      return this.$store.state.count;
    },
    title:function(){
      return this.$store.state.title;
    },
    cartList:function(){
      return this.$store.state.cartList;
    },
  },
}